<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%-- Layout Tiles
  This layout create a html page with <header> and <body> tags. It render
   a header, left menu, body and footer tile.
  @param title String use in page title
  @param header Header tile (jsp url or definition name)
  @param menu Menu
  @param lefmenu sub menu
  @param body Body
  @param shortcut some shortcut link
  @param footer Footer
--%>
<tiles:importAttribute name="leftmenu" ignore="true"/>
<tiles:importAttribute name="error" ignore="true"/>
<tiles:importAttribute name="body" ignore="true"/>

<html>
<head>
  <title><tiles:getAsString name="title"/></title>
  <link rel="stylesheet" href="<%=request.getContextPath()%>/style/main.css" type="text/css">
</head>
<body link=#000080 bgcolor="#ffffff" leftmargin="0" topmargin="0">
  <!-- begin header-->
  <table width="780" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
    <tr>
      <td height="130" background="<%=request.getContextPath()%>/images/homepage_top.jpg">
        <tiles:insert attribute="header" />
      </td>
    </tr>
  </table>
  <!-- end header-->

  <!-- begin menu-->
  <table width="780" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
    <tr>
      <td valign="top" align="left">
        <tiles:insert attribute='menu'/>
      </td>
    </tr>
  </table>
  <!-- end menu-->

  <table width="780" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
    <tr>
      <!--begin left menu-->
      <logic:present name="leftmenu">
      <logic:notEmpty name="leftmenu">
      <%
        String s = (String) request.getAttribute("menuOrder");

        if(s != null) {
          int menuOrder = Integer.parseInt(s);
          menuOrder = (menuOrder + 1) % 7;
		  if (menuOrder == 0) {
			menuOrder = 7;
		  }
      %>
      <td width="164" valign="top" background="<%=request.getContextPath()%>/images/homepage/menu<%=menuOrder%>/leftmenu_bg.gif"><tiles:insert attribute='leftmenu'/></td>
      <%
        } else if(request.getAttribute("echannelType") != null) {
      %>
      <td width="164" valign="top"><tiles:insert attribute='leftmenu'/></td>
      <%
        } else {
      %>
      <td width="164" valign="top" background="<%= request.getContextPath()%>/images/homepage/index_left_bg.gif"><tiles:insert attribute='leftmenu'/></td>
      <%
        }
      %>
      </logic:notEmpty>
      </logic:present>
      <!-- end left menu-->

      <!-- begin body-->
      <td valign="top" align="left">
        <table border="0" width="100%" cellspacing="5">
          <logic:present name="error">
          <logic:notEmpty name="error">
          <tr>
            <td align="center"><tiles:insert attribute="error" /></td>
          </tr>
          </logic:notEmpty>
          </logic:present>

          <tr>
            <logic:present name="body">
            <td><tiles:insert attribute="body" /></td>
            </logic:present>
          </tr>
        </table>
      </td>
      <!-- end body-->
    </tr>
  </table>
  <!-- begin footer -->
  <table width="780" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
    <tr>
      <td align="center">
        <tiles:insert attribute='shortcut'/>
      </td>
    </tr>
    <tr>
      <td align="center" background="<%=request.getContextPath()%>/images/button_bg_wide.gif">
        <tiles:insert attribute='footer'/>
      </td>
    </tr>
    <tr>
      <td valign="top" align="left">&nbsp;</td>
    </tr>
  </table>
  <!-- end footer -->
<script>
try {
	foldout();
} catch(e) {}
</script>
</body>
</html>


